﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace D.Traceability.Infrastructure.Migrations
{
    public partial class cxv : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "SU_BreedModel",
                columns: table => new
                {
                    BreedId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    BreedVariety = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BreedSource = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BreedDay = table.Column<int>(type: "int", nullable: true),
                    BreedBrand = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BreedOPeratorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BreedCrateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    TraceaBatch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaIsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_BreedModel", x => x.BreedId);
                });

            migrationBuilder.CreateTable(
                name: "SU_DeepModel",
                columns: table => new
                {
                    DeepId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DeepLeaderName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeppChargeName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaBatch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaIsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_DeepModel", x => x.DeepId);
                });

            migrationBuilder.CreateTable(
                name: "SU_EnterpriseModel",
                columns: table => new
                {
                    EnterId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    BreedName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BreedChargeName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BreedNum = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SlaughterName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SlaughterAdder = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SlaughterProvinceId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SlaughterCityId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SlaughterCountyId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SlaughterCreteTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SlaughterBrief = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeepName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    DeepNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaBatch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaIsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_EnterpriseModel", x => x.EnterId);
                });

            migrationBuilder.CreateTable(
                name: "SU_GoodsModel",
                columns: table => new
                {
                    GoodsId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GoodsName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaIsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_GoodsModel", x => x.GoodsId);
                });

            migrationBuilder.CreateTable(
                name: "SU_ImmunityModel",
                columns: table => new
                {
                    ImmunityId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ImmunityDay = table.Column<int>(type: "int", nullable: true),
                    ImmuniTyype = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ImmunityMethod = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaBatch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaIsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_ImmunityModel", x => x.ImmunityId);
                });

            migrationBuilder.CreateTable(
                name: "SU_ImproveModel",
                columns: table => new
                {
                    ImproveId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    BreedNum = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
                    SlaughterNum = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
                    DeepNum = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
                    ZNum = table.Column<decimal>(type: "decimal(18,2)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_ImproveModel", x => x.ImproveId);
                });

            migrationBuilder.CreateTable(
                name: "SU_PictureModel",
                columns: table => new
                {
                    PictureId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Url = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PTyper = table.Column<int>(type: "int", nullable: false),
                    TraceaBatch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaIsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_PictureModel", x => x.PictureId);
                });

            migrationBuilder.CreateTable(
                name: "SU_SlaughterModel",
                columns: table => new
                {
                    SlaughterId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    SlaughterBatch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Kg = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
                    ArriveTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    SlaughterTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    TraceaBatch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaIsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_SlaughterModel", x => x.SlaughterId);
                });

            migrationBuilder.CreateTable(
                name: "SU_SupplierModel",
                columns: table => new
                {
                    SuppId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    SuppType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SuppBatch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaBatch = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaIsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_SupplierModel", x => x.SuppId);
                });

            migrationBuilder.CreateTable(
                name: "SU_TraceabilityModel",
                columns: table => new
                {
                    TraceaId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GoodsName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    TraceaBatch = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    TraceaQualityDay = table.Column<int>(type: "int", nullable: false),
                    TraceaLicenseCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    TraceaEnterpriseName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    TraceaImprove = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
                    TraceaCreateName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    TraceaCreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    TraceaUpdateName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaUpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    TraceaPicture = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    TraceaIsNo = table.Column<bool>(type: "bit", nullable: false),
                    TraceaIsDelete = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SU_TraceabilityModel", x => x.TraceaId);
                });

            migrationBuilder.CreateIndex(
                name: "IX_SU_TraceabilityModel_TraceaBatch",
                table: "SU_TraceabilityModel",
                column: "TraceaBatch",
                unique: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "SU_BreedModel");

            migrationBuilder.DropTable(
                name: "SU_DeepModel");

            migrationBuilder.DropTable(
                name: "SU_EnterpriseModel");

            migrationBuilder.DropTable(
                name: "SU_GoodsModel");

            migrationBuilder.DropTable(
                name: "SU_ImmunityModel");

            migrationBuilder.DropTable(
                name: "SU_ImproveModel");

            migrationBuilder.DropTable(
                name: "SU_PictureModel");

            migrationBuilder.DropTable(
                name: "SU_SlaughterModel");

            migrationBuilder.DropTable(
                name: "SU_SupplierModel");

            migrationBuilder.DropTable(
                name: "SU_TraceabilityModel");
        }
    }
}
